package com.hsgene.order.constants;

import com.hsgene.common.util.exception.ErrorCode;

/**
 * 结算导出
 *
 * @author wxf
 * @date 2018/11/26 11:31
 **/
public enum SettlementErrorCode implements ErrorCode {
    /**
     * 导出error
     */
    SETTLEMENT_EXPROT_ERROR(90001, "SETTLEMENT_EXPROT_ERROR", "结算导出异常"),
    SETTLEMENT_EXPROT_INFO_IS_NOT_NULL(90002, "SETTLEMENT_EXPROT_INFO_IS_NOT_NULL", "导出信息不能为空"),
    SETTLEMENT_IMPORT_FILE_IS_NOT_NULL(90003, "SETTLEMENT_IMPORT_FILE_IS_NOT_NULL", "结算导入文件不能为空"),
    SETTLEMENT_IMPORT_IS_ERROR(90004, "SETTLEMENT_IMPORT_IS_ERROR", "结算导入异常"),
    SETTLEMENT_FILE_TYPE_ERROR(90005, "SETTLEMENT_FILE_TYPE_ERROR", "结算导入文件类型错误，只支持模版文件(.xlsx)导入"),
    PARAMS_IS_ERROR(80004, "PARAMS_IS_ERROR", "参数异常"),
    EXPORT_TYPE_IS_ERROR(80002, "EXPORT_TYPE_IS_ERROR", "数据导出类型(筛选或全部)不能为空"),
    EXPORT_SELECT_IS_ERROR(80004, "EXPORT_SELECT_IS_ERROR", "导出选中数据时，请至少选中一行"),
    EXPORT_FIELD_IS_NOT_NULL(80005, "EXPORT_FIELD_IS_NOT_NULL", "导出字段不能为空"),
    EXPORT_FIELF_IS_MORE(80006, "EXPORT_FIELF_IS_MORE", "存在导出列不在列表中"),
    EXPORT_FILE_IS_NOT_NULL(80003, "EXPORT_FILE_IS_NOT_NULL", "文件名不能为空"),
    EXPORT_TYPE_IS_NOT_NULL(80002, "EXPORT_TYPE_IS_NOT_NULL", "数据导出类型不能为空");

    private int code;
    private String message;
    private String description;

    SettlementErrorCode(int code, String message, String description) {
        this.code = code;
        this.message = message;
        this.description = description;
    }

    public static SettlementErrorCode getEnum(int code) {
        for (SettlementErrorCode type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        throw new IllegalStateException("不支持的Code：" + code);
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getDescription() {
        return description;
    }
}
